package com.work.demo.entity;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chuji
 * @date 2021/7/16
 */
@Component
public class Cache {


	private List<String> totalCacheList = new ArrayList<>();
	private List<String> incrCacheList = new ArrayList<>();


	public void addTotal(String obj) {
//        if (CollectionUtils.isEmpty(totalCacheList)){
//            totalCacheList = new ArrayList<>();
//        }
		totalCacheList.add(obj);
	}

	public void addIncr(String obj) {
//        if (CollectionUtils.isEmpty(incrCacheList)){
//            incrCacheList = new ArrayList<>();
//        }
		incrCacheList.add(obj);
	}


	public List<String> getTotalSize() {
		return totalCacheList == null ? new ArrayList<>() : totalCacheList;

	}

	public List<String> getIncrSize() {
		return incrCacheList == null ? new ArrayList<>() : incrCacheList;
	}

	public void clear() {
		totalCacheList.clear();
		incrCacheList.clear();
	}
}
